import java.util.*;
public class Catfish extends LivingBeing {
	private String ALIVE = "alive";
	private String DEAD = "dead";
	private int ENERGY_TO_SWIM = 2;
	private int row;
	private int column;
	private String imageFileName;
	private String deadOrAlive;
	private int age;
	private int energy;
	private Simulation simulation;
	public Catfish(
		int initialRow,
		int initialColumn,
		Simulation initialSimulation) {
			simulation = initialSimulation;
			deadOrAlive = ALIVE; 	
			age = 0;
			energy = 10;		
			imageFileName = "/Catfish-right.gif";	
			row = initialRow;
			column = initialColumn;
	}
	
	public int getRow() { 
               return row;  
}
	public int getColumn() { 
return column;
 }

	public String getImage() {
 return imageFileName; 
}

	public int getAge() {
 return age; 
}
               // Student:Please complete this method.

	public int getEnergy() { return energy; }
                // Student:Please complete this method.
	
	public void die() { 
                deadOrAlive = DEAD; }
                // Student:Please complete this method.

	public boolean isDead() {
		if(deadOrAlive == DEAD)
			return true;
		else
			return false;
	}
	private void swimIfPossible() {
               // Student:Please complete this method.

		energy -= ENERGY_TO_SWIM;
		if (energy > 0)
		{
			Random r = new Random(1);
			int ran1 = r.nextInt(4);
			if (ran1 == 0) column++;
			else if (ran1 == 1) column--;
			else if (ran1 == 2) row++;
			else row--;
		}
	}

	public void liveALittle() {
               // Student:Please complete this method.
		if (energy <= 0) die();
		age++;
		swimIfPossible();
	}

}
